﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.AspNet.SignalR;

namespace ERPStore.Realtime
{
	public class MessageHub : Hub
	{
		public bool Join(string streamName)
		{
			Groups.Add(Context.ConnectionId, streamName);
			return true;
		}

		public void Send(string streamName, object data)
		{
			if (Clients.Caller[streamName] == null)
			{
				Join(streamName);
			}
			Clients.Caller[streamName].addMessage(data);
		}
	}
}
